package com.huibo.shopping.config;

import java.util.Arrays;
import java.util.List;

import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

@Component
@Primary
public class DocumentionConfig implements SwaggerResourcesProvider {

	public List<SwaggerResource> get(){
		return Arrays.asList(
				swaggerResource("商品服务","/services/product/v2/api-docs","2.0"),
				swaggerResource("公共服务","/services/common/v2/api-docs","2.0"));
	}
	
	private SwaggerResource swaggerResource(String name,String location,String version) {
		SwaggerResource sr = new SwaggerResource();
		sr.setLocation(location);
		sr.setName(name);
		sr.setSwaggerVersion(version);
		return sr;
	}
}
